Expression Grammar
•Using Stored Values in Expressions
• Using Multiple Lines and Tab Spaces in Expressions
•Using Comments in Expressions
•Using Relationship Specifiers
An expression is a description of how to compute a value. It can call a function, be a reference to a field, or be a literal. Expressions can also be composed of one or more of these with operators in between them.
Expressions are used in many places throughout Neurons for ITSM, including in business rules, saved searches, quick action definitions, list filters, visibility rules on form controls, and more.
Most expressions simply compute a value. However, a few of the built-in functions do more than just compute a value. They affect the application in ways other than returning a value. For example, the Prompt function prompts the user for an input, and the GetNext Counter function returns the value of the counter but also increments the counter.
A subexpression is an expression within an expression that computes a value, but has a different context and may also be evaluated more than once. Currently, subexpressions can only be passed as arguments to certain built-in functions. The ChildFold, FindAncestor, ForEachChild, IfAllSiblings, IsTrueForAllChildren, Prompt, and PromptAndExecuteAction are the only built-in functions that use subexpressions.
An example of a subexpression is:
$(FindAncestor("Frs_CompositeContract_Entity", "ServiceAgreement", EntityLink_RecID,
"$((ServiceLink == [OtherObject]Service_Valid) && (Status == \"Published\"))"
))
The sub expression starts with "$((ServiceLink.
There are two ways to call a subexpression: the "old" way, which is to enter the entire subexpression as a string within double quotes, or the "new" way, which is to enter it without double quotes. (If you use the new way, you do not need to use the backslash to escape the quotes within the string.)
In this example, the function looks for an ancestor and for each one it finds, it evaluates the subexpression and each time it evaluates it, it has a different subcontext. The field references in the subexpression do not refer to the same object as the field references outside of the subexpression.
At the outer level, enclose an expression, function, or field reference with a dollar sign with parentheses, as follows:
$( )
The $( can only appear as the outer most portion of the expression, and should not appear anywhere within the expression itself, except as a subexpression. If you enter $( anywhere else within the expression, the parser cannot interpret the expression properly, and incorrectly interprets the entire expression as if it were a regular text literal.
In certain cases, the parser does allow for expressing simple values, without requiring the use of $(). An example is expressing simple text literal values such as "Active".
At this time, Neurons for ITSM does not allow you to add comments to expressions.
At the highest level, you enter either an expression or a standalone literal.
Stored expressions are expressions that Neurons for ITSM - Administrator and User Help maintains for reuse across the system. You can associate a stored expression with a business object, or you can leave the stored expression unassociated. For more information on Stored Expressions, see About Stored Expressions.
1.You can find stored expressions listed in the Expression Editor toolbox. You can drag stored expressions onto the editor from the toolbox, or as you begin typing the name of your stored expression, it autopopulates with matching expressions.
You need to manually add the outer $() syntax to stored expressions selected from either of these methods.
2.The syntax for calling a stored expression can vary depending on the context. Table 1 lists the syntax for each use context.
Table 1: Contextualized Stored Expression Syntax
Unassociated Stored Expression |
$(GlobalStoredExpression()) |
Associated Stored Expression for current business object context In this example, [this] is a literal value and should not be changed. |
$([this]AssociatedStoredExpression()) |
Associated stored expression for related business object context |
$([OtherBusOb#.refname]RelatedStoredExpression()) |
To call a built-in function, use this syntax:
$(FunctionName (arguments))
where arguments can be zero or more arguments to the function, separated by commas. The arguments can be expressions that compute values, field references, or literals.
See Working with Built-in Functions for complete information about all of the Neurons for ITSM built-in functions.
The values in expressions are represented as either floating point numbers or integers. Neurons for ITSM supports 32-bit and 64-bit integers.
However, all numbers in JavaScript are represented as double precision floating point numbers. Therefore, when expressions are executed on the client, we do not support integers at all, including 64-bit integers. Because double-precision floating point integers can only represent integers exactly between 2-53 and 253 -1, the application rounds any calculations of integers that are larger or smaller than that, but less than 2-64 through 264 -1.
Neurons for ITSM allows you to store values for reuse across the platform anywhere you can use the Expression Editor. For more information about Stored Values, see About Stored Values.
1.To use a stored value in an expression, use the system function GetStoredValue.
2.The resulting expression looks like: $(GetStoredValue("YourStoredValueNameHere")).
You can add multiple lines and tab spaces in expressions, which are retained after saving the expression in the Expression Editor. When you open the expression in the Expression Editor the formatting you applied is preserved.
New lines and tab spaces are supported in expression field controls, and can be edited directly in these fields while preserving new lines. New lines are indicated by a line break symbol .
To add new lines and tab spaces:
•Press the Enter key to add a new line in the Expression Editor.
•Press Alt + Enter to add a line break when editing an expression in an expression field. This adds a line break symbol in the field, it does not display an actual break in the line. The new line is displayed if you open the expression in the Expression Editor.
•Press the Tab key to add a tab space to a line.
You can also add comments to your expression, see Using Comments in Expressions